import java.io.*;
import java.util.*;

public class Main {
    String input;
    BufferedReader br;
    StringTokenizer st;
    StringBuilder sb;

    int n;
    long d;
    Node[] computers;

    public Main() {
        br = new BufferedReader(new InputStreamReader(System.in));
        sb = new StringBuilder();
    }

    public static void main(String[] args) {
        Main main = new Main();
        try {
            main.beginProcess();
        } catch(IOException ioEx) {
            ioEx.printStackTrace();
        } catch(Exception ex) {
            ex.printStackTrace();
        }
    }

    void beginProcess() throws IOException {
        n = 1005;
        computers = new Node[n];
        input = br.readLine();
        st = new StringTokenizer(input);
        n = Integer.parseInt(st.nextToken());
        d = Long.parseLong(st.nextToken());
        for(int i = 1; i <= n; i++) {
            input = br.readLine();
            st = new StringTokenizer(input);
            computers[i] = new Node(i, Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        String token;
        while((input = br.readLine()) != null) {
            input = br.readLine();
            st = new StringTokenizer(input);

            token = st.nextToken();
            if(token.equals("O")) {
                connect(Integer.parseInt(st.nextToken()));
            } else if(token.equals("S")) {
                if(isDisjoint(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())))
                    sb.append("SUCCESS\n");
                else
                    sb.append("FAIL\n");
            }
        }

        System.out.print(sb);
    }

    void connect(int k) {
        computers[k].repaired = true;
        for(int i = 1; i <= n; i++) {
            if(computers[i] == null)
                break;
            if(i == k)
                continue;
            if(ceilDistance(k, i) <= d)
                join(k, i);
        }
    }

    long ceilDistance(int k, int i) {
        long xk = computers[k].x,
             yk = computers[k].y,
             xi = computers[i].x,
             yi = computers[i].y;
        return (long)Math.ceil(
                         Math.pow(
                             Math.pow(xk - xi, 2) + Math.pow(yk - yi, 2), 0.5));
    }

    int find_set(int k) {
        if(computers[k].rep == k)
            return k;
        else
            return computers[k].rep = find_set(computers[k].rep);
    }

    void join(int k1, int k2) {
        k1 = find_set(k1);
        k2 = find_set(k2);
        if(k1 != k2)
            computers[k2].rep = k1;
    }

    boolean isDisjoint(int k1, int k2) {
        k1 = find_set(k1);
        k2 = find_set(k2);
        if(k1 == k2)
            return true;
        return false;
    }

}

class Node {
    int rep;
    long x, y;
    boolean repaired;

    public Node(int rep, int x, int y) {
        this.rep = rep;
        this.x = x;
        this.y = y;
        repaired = false;
    }

}
